package  
{
	import nl.acidcats.yalog.Yalog;
	import nl.acidcats.yalog.util.YaLogConnector;

	import temple.core.debug.log.Log;
	import temple.core.display.CoreSprite;
	import temple.utils.PerformanceStat;
	import temple.utils.types.ArrayUtils;

	import flash.events.Event;

	/**
	 * @author Thijs Broerse
	 */
	public class YalalaTest extends CoreSprite 
	{
		private static const _TEST_STRINGS:Array = ["Lorem ipsum dolor sit amet", "consectetur adipiscing elit.", "Nam hendrerit, mauris sit amet pulvinar consequat", "leo odio lobortis lectus", "non ullamcorper sapien lectus vitae eros."];
		
		Log.stackTrace = true;
		Yalog.sendAsByteArray = false;
		
		private var _counter:uint;
		
		public function YalalaTest()
		{
			super();
			
			YaLogConnector.connect('YalalaTest');

			this.addEventListener(Event.ENTER_FRAME, handleEvent);
			
			this.addChild(new PerformanceStat());
		}

		private function handleEvent(event:Event):void 
		{
			var i:uint = Math.random() * 6;
			
			switch(i)
			{
				case 0:
					this.logInfo(this._counter++ + " info test log message " + ArrayUtils.randomElement(_TEST_STRINGS));
					break;
				case 1:
					this.logDebug(this._counter++ + " debug test log message " + ArrayUtils.randomElement(_TEST_STRINGS));
					break;
				case 2:
					this.logError(this._counter++ + " error test log message " + ArrayUtils.randomElement(_TEST_STRINGS));
					break;
				case 3:
					this.logFatal(this._counter++ + " fatal test log message " + ArrayUtils.randomElement(_TEST_STRINGS));
					break;
				case 4:
					this.logStatus(this._counter++ + " status test log message " + ArrayUtils.randomElement(_TEST_STRINGS));
					break;
				case 5:
					this.logWarn(this._counter++ + " warn test log message " + ArrayUtils.randomElement(_TEST_STRINGS));
					break;
				case 6:
					this.logInfo(dump(this, 0, false));
					break;
			}
		}
	}
}
